<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table{
            width: 100%;
            border: 1px solid red;
            border-spacing: 0;
            border-collapse: collapse;
            margin-top: 100px;
        }
        tr{
            width: 100%;
            border: 1px solid red;
        }
        td{
            width: 70px;
            height: 50px;
            border: 1px solid red;
        }
    </style>
</head>
<body>
   
    <input type="text" id="in1">
    <input type="text" id="in2">
    <input type="button" id="btn" value="生成表格">
    <table id="t"></table>
    <script>
          
        btn.onclick=function(){
            t.innerHTML=""
            var input1=in1.value
            var input2=in2.value
            console.log(input1,input2)


            for(var i=1;i<=input1;i++){
                let tr=document.createElement("tr")
                    t.appendChild(tr)
                for(var j=1;j<=input2;j++){
                    let td=document.createElement("td")
                    tr.appendChild(td)
            }
            }
         
        
        }
    </script>
</body>
</html>